package com.javalong.affairs.module.renwujinzhang.activity.disagree;

import android.content.Context;
import android.content.Intent;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.View;

import com.javalong.affairs.R;
import com.javalong.affairs.module.main.ui.BottomBar;
import com.javalong.affairs.module.renwujinzhang.activity.TaskActivity;
import com.javalong.affairs.module.renwujinzhang.activity.disagree.fragment.AllDisagreeFragment;

/**
 * Created by 杨观回 on 2016/2/28 0028.
 */
public class DisagreeListActivity extends TaskActivity implements
        BottomBar.OnBottomClick {
    private BottomBar bottomBar;
    private Fragment listFragment;
    private AllDisagreeFragment allSuperviseFragment;
    private int[] drawables = new int[]{R.drawable.newmain_level_f1};

    private String[] tips = new String[]{
            "所有"
    };

    public static void toThisActivity(Context context) {
        Intent intent = new Intent();
        intent.setClass(context, DisagreeListActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected void initLayout() {
        setContentView(R.layout.activity_tracktask);
        bottomBar = (BottomBar) findViewById(R.id.ui_bottombar);
        bottomBar.setOnBottonClick(this);
        bottomBar.initWithData(drawables, tips);
        bottomBar.setVisibility(View.GONE);
    }

    @Override
    protected void initData() {
        loadOneFragment();
    }

    private void loadOneFragment() {
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        listFragment = new AllDisagreeFragment();
        ft.add(R.id.fl_content, listFragment);
        ft.commit();
    }

    @Override
    public void onBottomClick(int index) {
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        switch (index) {
            case 0:
                if (allSuperviseFragment == null) {
                    allSuperviseFragment = new AllDisagreeFragment();
                }
                listFragment = allSuperviseFragment;
                break;
        }
        ft.replace(R.id.fl_content, listFragment);
        ft.commit();
    }

}
